package com.sqrj.phoneorder;

import com.sqrj.phoneorder.Controller.interceptor.MiniInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by xxlc .
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/**")
//                .addResourceLocations("classpath:/META-INF/resources/")
//                .addResourceLocations("file:E:/quincy_videos_dev/");
//    }

    @Bean
    public MiniInterceptor miniInterceptor(){
        return new MiniInterceptor();
    }


//    添加要拦截的地址
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(miniInterceptor()).addPathPatterns("/querySendChart")
                .addPathPatterns("/queryWxUnitById")
                .addPathPatterns("/querystSendRecord", "/querystSendHZ")
                .addPathPatterns("/queryWxUnitsById")
                .addPathPatterns("/delWxUnitByid")
                .addPathPatterns("/addWxUnit")
                .addPathPatterns("/demo/superadmin/modifyarea")
                .addPathPatterns("/addWxHntRWD")
                .excludePathPatterns("/user/queryPublisher");
        super.addInterceptors(registry);
    }
}
